package com.yanqu.road.logic.activity.foxcard.game.label;

import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.math.BigDecimal;

/**
 * 翻倍当前金币，有最高限制
 * 额外倍率|最高限制|0|0
 */
public class FoxCardLabel5 extends FoxCardLabelBase {
    @Override
    protected int labelHandle(FoxCardGameLogic gameLogic) {
        if (triggerType != eFoxCardTriggerType.SKIP) {
            return 0;
        }

        int multi = labelConfig.getParamList().get(0);
        int goldMax = labelConfig.getParamList().get(1);

        int calcGold = Math.min(goldMax, gameLogic.getGameData().getGold());

        if (multi > 0) {
            int goldAdd = BigDecimal.valueOf(calcGold).multiply(BigDecimal.valueOf(multi).divide(BigDecimal.valueOf(1000))).intValue();
            gameLogic.goldChange(goldAdd, null, null, triggerType);
        }

        return 1;
    }
}
